package com.guonl.open.api.client;


import com.guonl.open.api.WlhyOpenApiClientConfiguration;
import com.guonl.open.api.config.OpenApiInterceptor;
import com.guonl.open.api.request.waybill.ApiCloseTransportNoteRequest;
import com.guonl.open.api.request.waybill.ApiCreateTransportNoteRequest;
import com.guonl.open.api.request.waybill.ApiTransportNoteUpdateFreightRequest;
import com.guonl.open.api.request.waybill.ApiVehicleTrackRequest;
import com.guonl.open.api.response.OpenApiResult;
import com.guonl.open.api.response.waybill.ApiTransportNoteInfoResponse;
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestHeader;

@ConditionalOnProperty(prefix = "openapi", name = "service-url")
@FeignClient(name = "openApiWaybillClient", url = "${openapi.service-url}", configuration = {OpenApiInterceptor.class, WlhyOpenApiClientConfiguration.class})
public interface OpenApiWaybillClient {

    @PostMapping("/oauth/v1/waybill/create")
    OpenApiResult<ApiTransportNoteInfoResponse> createTransportNote(@RequestBody ApiCreateTransportNoteRequest createTransportNoteRequest, @RequestHeader("api-key") String apiKey);

    @PostMapping("/oauth/v1/waybill/updateFreight")
    OpenApiResult<Boolean> transportNoteUpdateFreight(@RequestBody ApiTransportNoteUpdateFreightRequest updateFreightRequest, @RequestHeader("api-key") String apiKey);

    @PostMapping("/oauth/v1/waybill/close")
    OpenApiResult<Boolean> closeTransportNote(@RequestBody ApiCloseTransportNoteRequest closeTransportNoteRequest, @RequestHeader("api-key") String apiKey);

    @PostMapping("/oauth/v1/waybill/addVehicleTrack")
    OpenApiResult<Boolean> transportNoteVehicleTrack(@RequestBody ApiVehicleTrackRequest vehicleTrackRequest, @RequestHeader("api-key") String apiKey);

}
